home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / FileTransfers.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  5.8 KB  |  206 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        FileTransfers.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __FILETRANSFERS__
  13. #define __FILETRANSFERS__
  14.  
  15. #ifndef __PACKAGES__
  16. #include <Packages.h>
  17. #endif
  18.  
  19. #ifndef __CTBUTILITIES__
  20. #include <CTBUtilities.h>
  21. #endif
  22.  
  23. #ifndef __CONNECTIONS__
  24. #include <Connections.h>
  25. #endif
  26.  
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30.  
  31.  
  32. enum {
  33.  
  34.  
  35. /* current file transfer manager version */
  36.  curFTVersion = 2,
  37.  
  38. /* FTErr    */
  39.  ftGenericError = -1,
  40.  ftNoErr = 0,
  41.  ftRejected = 1,
  42.  ftFailed = 2,
  43.  ftTimeOut = 3,
  44.  ftTooManyRetry = 4,
  45.  ftNotEnoughDSpace = 5,
  46.  ftRemoteCancel = 6,
  47.  ftWrongFormat = 7,
  48.  ftNoTools = 8,
  49.  ftUserCancel = 9,
  50.  ftNotSupported = 10
  51. };
  52.  
  53. typedef OSErr FTErr;
  54.  
  55. enum {ftIsFTMode = 1 << 0,ftNoMenus = 1 << 1,ftQuiet = 1 << 2,ftConfigChanged = 1 << 4,
  56.  ftSucc = 1 << 7};
  57. typedef unsigned long FTFlags;
  58.  
  59. enum {ftSameCircuit = 1 << 0,ftSendDisable = 1 << 1,ftReceiveDisable = 1 << 2,
  60.  ftTextOnly = 1 << 3,ftNoStdFile = 1 << 4,ftMultipleFileSend = 1 << 5};
  61. typedef unsigned short FTAttributes;
  62.  
  63. enum {ftReceiving,ftTransmitting};
  64. typedef unsigned short FTDirection;
  65.  
  66.  
  67. struct FTRecord {
  68.  short procID;
  69.  FTFlags flags;
  70.  FTErr errCode;
  71.  long refCon;
  72.  long userData;
  73.  ProcPtr defProc;
  74.  Ptr config;
  75.  Ptr oldConfig;
  76.  ProcPtr environsProc;
  77.  long reserved1;
  78.  long reserved2;
  79.  Ptr ftPrivate;
  80.  ProcPtr sendProc;
  81.  ProcPtr recvProc;
  82.  ProcPtr writeProc;
  83.  ProcPtr readProc;
  84.  WindowPtr owner;
  85.  FTDirection direction;
  86.  SFReply theReply;
  87.  long writePtr;
  88.  long readPtr;
  89.  char *theBuf;
  90.  long bufSize;
  91.  Str255 autoRec;
  92.  FTAttributes attributes;
  93. };
  94.  
  95. typedef struct FTRecord FTRecord;
  96. typedef FTRecord *FTPtr, **FTHandle;
  97.  
  98.  
  99. enum {
  100.  
  101.  
  102. /* FTReadProc messages */
  103.  ftReadOpenFile = 0,    /* count = forkFlags, buffer = pblock from PBGetFInfo */
  104.  ftReadDataFork = 1,
  105.  ftReadRsrcFork = 2,
  106.  ftReadAbort = 3,
  107.  ftReadComplete = 4,
  108.  ftReadSetFPos = 6,        /* count = forkFlags, buffer = pBlock same as PBSetFPos */
  109.  ftReadGetFPos = 7,        /* count = forkFlags, buffer = pBlock same as PBGetFPos */
  110.  
  111. /* FTWriteProc messages */
  112.  ftWriteOpenFile = 0,    /* count = forkFlags, buffer = pblock from PBGetFInfo */
  113.  ftWriteDataFork = 1,
  114.  ftWriteRsrcFork = 2,
  115.  ftWriteAbort = 3,
  116.  ftWriteComplete = 4,
  117.  ftWriteFileInfo = 5,
  118.  ftWriteSetFPos = 6,    /* count = forkFlags, buffer = pBlock same as PBSetFPos */
  119.  ftWriteGetFPos = 7,    /* count = forkFlags, buffer = pBlock same as PBGetFPos */
  120.  
  121. /* fork flags */
  122.  ftOpenDataFork = 1,
  123.  ftOpenRsrcFork = 2
  124.  
  125. };
  126.  
  127. /* application routines type definitions */
  128. typedef pascal OSErr (*FileTransferReadProcPtr) (unsigned long *count, Ptr pData, long refCon, short fileMsg);
  129. typedef pascal OSErr (*FileTransferWriteProcPtr) (unsigned long *count, Ptr pData, long refCon, short fileMsg);
  130.  
  131. typedef pascal Size (*FileTransferSendProcPtr) (Ptr thePtr, long theSize, long refCon, CMChannel channel, CMFlags flag);
  132. typedef pascal Size (*FileTransferReceiveProcPtr) (Ptr thePtr, long theSize, long refCon, CMChannel channel, CMFlags *flag);
  133.  
  134. typedef pascal OSErr (*FileTransferEnvironsProcPtr) (long refCon, ConnEnvironRec *theEnvirons);
  135.  
  136. typedef pascal void  (*FileTransferNotificationProcPtr) (FTHandle hFT, FSSpecPtr pFSSpec);
  137. typedef pascal void  (*FileTransferChooseIdleProcPtr) (void);
  138.  
  139. #ifdef __cplusplus
  140. extern "C" {
  141. #endif
  142. pascal FTErr InitFT(void); 
  143. pascal Handle FTGetVersion(FTHandle hFT); 
  144. pascal short FTGetFTVersion(void); 
  145.  
  146. pascal FTHandle FTNew(short procID,FTFlags flags,FileTransferSendProcPtr sendProc,
  147.  FileTransferReceiveProcPtr recvProc,FileTransferReadProcPtr readProc,FileTransferWriteProcPtr writeProc,
  148.  FileTransferEnvironsProcPtr environsProc,WindowPtr owner,long refCon,long userData); 
  149.  
  150. pascal void FTDispose(FTHandle hFT); 
  151.  
  152. pascal FTErr FTStart(FTHandle hFT,FTDirection direction,const SFReply *fileInfo); 
  153. pascal FTErr FTAbort(FTHandle hFT); 
  154.  
  155. pascal FTErr FTSend(FTHandle hFT,short numFiles,FSSpecArrayPtr pFSSpec,
  156.  FileTransferNotificationProcPtr notifyProc); 
  157. pascal FTErr FTReceive(FTHandle hFT,FSSpecPtr pFSSpec,FileTransferNotificationProcPtr notifyProc); 
  158.  
  159. pascal void FTExec(FTHandle hFT); 
  160.  
  161. pascal void FTActivate(FTHandle hFT,Boolean activate); 
  162. pascal void FTResume(FTHandle hFT,Boolean resume); 
  163. pascal Boolean FTMenu(FTHandle hFT,short menuID,short item); 
  164.  
  165. pascal short FTChoose(FTHandle *hFT,Point where,FileTransferChooseIdleProcPtr idleProc); 
  166. pascal void FTEvent(FTHandle hFT,const EventRecord *theEvent); 
  167.  
  168. pascal Boolean FTValidate(FTHandle hFT); 
  169. pascal void FTDefault(Ptr *theConfig,short procID,Boolean allocate); 
  170.  
  171. pascal Handle FTSetupPreflight(short procID,long *magicCookie); 
  172. pascal void FTSetupSetup(short procID,const void *theConfig,short count,
  173.  DialogPtr theDialog,long *magicCookie); 
  174. pascal Boolean FTSetupFilter(short procID,const void *theConfig,short count,
  175.  DialogPtr theDialog,EventRecord *theEvent,short *theItem,long *magicCookie); 
  176. pascal void FTSetupItem(short procID,const void *theConfig,short count,
  177.  DialogPtr theDialog,short *theItem,long *magicCookie); 
  178. pascal void FTSetupXCleanup(short procID,const void *theConfig,short count,
  179.  DialogPtr theDialog,Boolean OKed,long *magicCookie); 
  180.  
  181. pascal void FTSetupPostflight(short procID); 
  182.  
  183. pascal Ptr FTGetConfig(FTHandle hFT); 
  184. pascal short FTSetConfig(FTHandle hFT,const void *thePtr); 
  185.  
  186. pascal OSErr FTIntlToEnglish(FTHandle hFT,const void *inputPtr,Ptr *outputPtr,
  187.  short language); 
  188. pascal OSErr FTEnglishToIntl(FTHandle hFT,const void *inputPtr,Ptr *outputPtr,
  189.  short language); 
  190.  
  191. pascal void FTGetToolName(short procID,Str255 name); 
  192. pascal short FTGetProcID(ConstStr255Param name); 
  193.  
  194. pascal void FTSetRefCon(FTHandle hFT,long refCon); 
  195. pascal long FTGetRefCon(FTHandle hFT); 
  196.  
  197. pascal void FTSetUserData(FTHandle hFT,long userData); 
  198. pascal long FTGetUserData(FTHandle hFT); 
  199.  
  200. pascal void FTGetErrorString(FTHandle hFT,short id,Str255 errMsg); 
  201. #ifdef __cplusplus
  202. }
  203. #endif
  204.  
  205. #endif
  206.